package com.suxin.service_hello.controller;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class HelloController {


    private Logger logger = LoggerFactory.getLogger(HelloController.class);

    @Value("${server.port}")
    private String port;


    @Value("${service.name}")
    private String serviceName;

    @Value("${service.version}")
    private String serviceVersion;

    @GetMapping(value = "hello")
    public String hello(@RequestParam(value = "name", defaultValue = "hello_suxin") String name) {
        logger.info("service_hello 被调用，参数:serviceName:{}, serviceVersion:{}, name:{}",serviceName, serviceVersion, name);

        return "hello "+ name +", i am service_hello i am from "+ port;
    }



}
